home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / restruc.zip / RESTRUC.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1993-01-04  |  1.9 KB  |  58 lines

  1. {
  2. รจ{                        RESTRUC.PAS
  3.  
  4.   Renames subdirectories and files, moves files to different
  5.   directories without copying the file (directory change only).
  6.   Restruc can also be used to rename files.Renaming directories
  7.   only works in DOS 3.0 or above.
  8.  
  9.   Derived from Michael Toutonghi's idea in PC MAGAZINE, I
  10.   simply added error checking for no command line entry,
  11.   duplicate filenames or non-existent files. I also added
  12.   a help message that only prints if the restructure is
  13.   not successful.
  14.  
  15.                         Loren Cook
  16.                         January 15, 1986
  17.                         Compuserve 70015,1101
  18.  
  19.   Copyright (c) 1986 by Loren J. Cook
  20.  
  21.   Unlimited free use and reproduction of this text and the program
  22.   associated with it are hereby granted to all users provided that
  23.   no charge or levy is made for the use, copying or operation
  24.   thereof. The right to sell this text or any of the programs
  25.   associated therewith is expressly not granted to any person, firm
  26.   or corporation.                                                             }
  27.  
  28.  
  29. PROGRAM Restruc;
  30.  
  31. VAR file_to_change : FILE;
  32.  
  33. PROCEDURE Help;
  34. BEGIN
  35.   WRITELN;
  36.   LOWVIDEO; WRITELN('RESTRUC Help:');
  37.   WRITELN;
  38.   NORMVIDEO; WRITELN('RESTRUC \subdir\filename \subdir\filename');
  39.   LOWVIDEO; WRITELN('moves a file from one subdirectory to another');
  40.   WRITE('or ');
  41.   NORMVIDEO; WRITE('RESTRUC \subdir \subdir');
  42.   LOWVIDEO; WRITELN(' renames a subdirectory.');
  43.   NORMVIDEO;
  44.   HALT;
  45. END;
  46.  
  47. BEGIN
  48.   IF PARAMSTR(1) = '' THEN Help;
  49.   ASSIGN(file_to_change, PARAMSTR(1));
  50.   {$I-}
  51.   RENAME(file_to_change, PARAMSTR(2));
  52.   {$I+}
  53.   IF IORESULT > 0 THEN BEGIN;
  54.     WRITELN;
  55.     WRITELN('Unable to find file or duplicate filename!');
  56.     Help;
  57.     END;
  58. END.
  59.